#include "Search.h"
#include "Mutex.h"
#include <iostream>

using namespace std;

extern Mutex *s_mutex;
extern bool s_found;

Search::Search( int *_array )
{
	this->_total = 16;
	this->_array = _array;
}
Search::~Search(){}

void Search::run()
{
	for ( int i = 0; i < this->_total; i++ )
	{
		if ( this->_array[i] == 10 )
		{
			s_mutex->lock();		
			s_mutex->signal();
			s_found = true;
			s_mutex->unlock();
		}
	}
	stop();
}